<?php
    $eventRepertoireMembers = $data['members'];
    if (empty($eventRepertoireMembers)) {
        $eventRepertoireMembers = array(array());
    }
?>
<div class="left span50p">
    <strong class="left"><?= __('members') ?>:</strong><br>
    <div class="multi-inputs left" id="repertoireMembers_<?= $index ?>">
        <? foreach ($eventRepertoireMembers as $k=>$erm): ?>
        <span class="multi-input left">
            <?= $this->Form->hidden("EventsRepertoireMember.{$index}.id.", array('value'=>(int)@$erm['id'])) ?>
            <?= $this->Form->select("EventsRepertoireMember.{$index}.member_id.", $allMembers, array(
                'empty' => false,
                'value' => @$erm['member_id']
            )) ?>
        </span>
        <? endforeach ?>
    </div>
</div>


<?php
    $eventRepertoireGuests = $data['guests'];
    if (empty($eventRepertoireGuests)) {
        $eventRepertoireGuests = array(array());
    }
?>
<div class="left program-guests-list span30p">
    <strong class="left"><?= __('guests') ?>:</strong><br>
    <div class="multi-inputs left" id="repertoireGuests_<?= $index ?>">
        <? foreach ($eventRepertoireGuests as $k=>$erg): ?>
        <span class="multi-input left">
            <?= $this->Form->hidden("EventsRepertoireGuest.{$index}.id.", array('value'=>(int)@$erg['id'])) ?>
            <?= $this->Form->select("EventsRepertoireGuest.{$index}.guest_id.", $allGuests, array(
                'value' => @$erg['guest_id'],
                'empty' => false
            )) ?>
        </span>
        <? endforeach ?>
    </div>
</div>

<script type="text/javascript">
function  repertoireMembers_<?= $index ?>_onAdd(item) {
    item.children('input[type=hidden]').val('')
}
function  repertoireGuests_<?= $index ?>_onAdd(item) {
    item.children('input[type=hidden]').val('')
}
</script>
